package com.wanmait.community.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.*;
import java.util.Date;

/**
 * 单元表
 */
@Data
@Accessors(chain = true)
@TableName(value = "unit")
public class Unit {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 单元名字
     */
    @TableField(value = "unit_name")
    @NotEmpty(message = "楼栋名不能为空")
    @Pattern(regexp = ".*单元", message = "单元名的格式：*单元,请不要随便填写")
    private String unitName;

    /**
     * 层数
     */
    @TableField(value = "`floor`")
    @NotNull(message = "楼层不能为空")
    @Min(value = 6,message = "楼层必须大于6层")
    @Max(value = 26,message = "楼层必须小于26")
    private Integer floor;

    /**
     * 有无电梯1有0无
     */
    @TableField(value = "elevator")
    @NotNull(message = "电梯状态不能为空")
    private Boolean elevator;

    /**
     * 楼栋id
     */
    @TableField(value = "building_id")
    @NotNull(message = "楼栋不能为空")
    private Integer buildingId;
    //非表属性
    @TableField(exist = false)
    private Building building;
    /**
     * 创建用户id
     */
    @TableField(value = "creat_by")
    private Integer creatBy;

    /**
     * 创建时间
     */
    @TableField(value = "creat_time")
    private Date creatTime;

    /**
     * 更新用户id
     */
    @TableField(value = "update_by")
    private Integer updateBy;

    /**
     * 更新时间
     */
    @TableField(value = "update_time")
    private Date updateTime;

    /**
     * 备注
     */
    @TableField(value = "remark")
    private String remark;

    /**
     * 逻辑删除
     */
    @TableField(value = "`enable`")
    private Boolean enable;
}